package cn.stylefeng.guns.topspeedCarRace;

import cn.hutool.core.util.RandomUtil;
import com.google.common.collect.Sets;

import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;

public class SSQTest {
    public static void main(String[] args) {
        initSet();
        for (int i = 0; i < 10; i++) {
            doTest();
        }
    }

    public static final Set<Integer> setRed = Sets.newHashSet();
    public static final Set<Integer> setBlue = Sets.newHashSet();

    public static void initSet() {
        while (true) {
            if (setRed.size() == 6) {
                break;
            }
            setRed.add(RandomUtil.randomInt(1, 33));
        }
        if (setBlue.size() == 0) {
            setBlue.add(RandomUtil.randomInt(1, 16));
        }
        System.out.println(setRed);
        System.out.println(setBlue);
    }

    public static final AtomicInteger num = new AtomicInteger(0);

    public static Boolean chou() {
        Boolean boo = true;
        for (int i = 0; i < 6; i++) {
            boo = setRed.contains(RandomUtil.randomInt(1, 33));
            if (!boo) {
                break;
            }
        }
        if (boo) {
            boo = setBlue.contains(RandomUtil.randomInt(1, 16));
        }
        if (boo) {
            System.out.println("-------------------------");
        }
        return boo;
    }

    public static void doTest() {

        while (true) {
            if (chou()) {
                break;
            }
            int n = num.incrementAndGet();
            if (n % 10000 == 0) {
//                System.out.println(n);
            }
        }
        System.out.println(num.get());
        System.out.println(num.get() / 150);
    }


}
